VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "TestRawFineMethodCaller"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Private mCaller As FineMethodCaller
Private mCalled As Boolean
Private mRaise As Boolean

Private mNotify As New MockNotifier

Public Sub testRawFMCNoError()
givenRawFMC
whenCalled

thenCalled
thenNoErrors
End Sub
Public Sub testRawFMCErrorCallback()
givenRawFMC
whenCalledWithCallback

thenCalled
thenOneError
End Sub

''
''
Private Sub givenRawFMC()
Set mCaller = New FineMethodCaller
End Sub
Private Sub whenCalledWithCallback()
mRaise = True
whenCalled
End Sub
Private Sub whenCalled()
mCaller.init "", Me
mCaller.forward mNotify
End Sub

Private Sub thenCalled()
assert.isTrue mCalled, "Called"
End Sub
Private Sub thenNoErrors()
assert.equals mCaller.errorInfo.number, 0, "No Errors"
End Sub
Private Sub thenOneError()
assert.equals mCaller.errorInfo.number, 1001, "Error is 1001"
End Sub


'forwarded call
Public Sub forward()
mCalled = True
On Error GoTo handler
If mRaise Then
    Err.Raise 1001
End If
Exit Sub
handler:
mCaller.handleError
End Sub

'OPTIONAL METHODS
Public Sub setup()
mRaise = False
End Sub
Public Function NumOfAsserts() As Long
NumOfAsserts = 4
End Function

